import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'



Vue.use(Router)

const router = new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      redirect:'/home',
      component: Home,
      children:[
        {
          path:'/home',
          name:'index',
          component: () => import(/* webpackChunkName: "index" */ './views/Home/Index.vue')
        },
        {
          path:'/class',
          name:'class',
          component: () => import(/* webpackChunkName: "class" */ './views/Home/Class.vue')
        },
        {
          path:'/cart',
          name:'cart',
          component: () => import(/* webpackChunkName: "cart" */ './views/Home/Cart.vue')
        },
        {
          path:'/mine',
          name:'mine',
          component: () => import(/* webpackChunkName: "mine" */ './views/Home/Mine.vue')
        },
      ]
    },
    {
      path:'/search',
      name:'search',
      component: () => import(/* webpackChunkName: "search" */ './views/Public/Search.vue')
    },
    {
      path:'/detail',
      name:'detail',
      component: () => import(/* webpackChunkName: "detail" */ './views/Public/GoodDetail.vue')
    },
    {
      path:'/good_list',
      name:'good_list',
      component: () => import(/* webpackChunkName: "good_list" */ './views/Public/GoodList.vue')
    },
    //收货地址
    {
      path:'/address',
      name:'address',
      component: () => import(/* webpackChunkName: "address" */ './views/Mine/Addr.vue')
    },
    //收货地址添加编辑
    {
      path:'/addr_edit',
      name:'addr_edit',
      component: () => import(/* webpackChunkName: "addr_edit" */ './views/Mine/AddrEdit.vue')
    },
    //优惠券
    {
      path:'/coupon',
      name:'coupon',
      component: () => import(/* webpackChunkName: "coupon" */ './views/Mine/Coupon.vue')
    },
  
  ]
})

router.beforeEach((to,from,next)=>{
 
    next()
  
})

router.afterEach(()=>{

})

export default router 
